#include <stdio.h>
int run(int a,int b){
    int count=0;
    int c[2000];
    for(int i=a;i<=b;i++)
    {if((i%4==0 && i%100!=0)||i%400==0)
        {c[count]=i;
        count++;}
    }
    printf("%d \n",count);
    for(int j=0;j<count;j++)
        {printf("%d ",c[j]);}
}
int main(){
   int x,y;
   scanf("%d %d",&x,&y);
   run(x,y);
}